package com.snailthink.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @program: springmvc-study
 * @description:
 * @author: SnailThink
 * @create: 2021-03-11 19:59
 **/
@Controller
@RequestMapping("/annotation")
public class HelloController {

	//真实访问地址 : 项目名/annotation/hello
	@RequestMapping("/hello")
	public String sayHello(Model model){
		//向模型中添加属性msg与值，可以在JSP页面中取出并渲染
		model.addAttribute("msg","hello,annotation-SpringMVC");
		//web-inf/jsp/hello.jsp
		return "hello";
	}

}

